<!DOCTYPE html>
<html>
  <head>
    <title><%= title %></title>
    <link rel="stylesheet" href="/stylesheets/style.css" />
  </head>
  <body>
    <h1><%= title %></h1>
    <p>Welcome to <%= title %></p>
    <p><span>请打开控制台查看输出</span></p>
    <p><span> 测试移动端可以点击切换移动端再测试</span></p>
    <script>
      const ua = navigator.userAgent
      /* 测试微信环境函数 */
      const isWeiXn = () => {
        const uaN = ua.toLowerCase()
        return uaN.includes('micromessenger')
      }
      // document.querySelector("#content").innerText = isWeiXn();
      console.log('测试微信环境:', isWeiXn())
      /* 检测是移动端-PC端 */
      const isMobile = () => {
        return Boolean(
          ua.match(
            /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
          )
        )
      }
      console.log('测试移动端-PC端:', isMobile() ? '移动端' : 'PC端')
      const isAndroid = ua.indexOf('Android') > -1 || ua.indexOf('Adr') > -1 //android终端
      const isiOS = Boolean(ua.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)) //ios终端
      console.log('测试android终端:', isAndroid)
      console.log('测试ios终端:', isiOS)
      const kernelInfo = () => {
        return {
          trident: ua.indexOf('Trident') > -1, //IE内核
          presto: ua.indexOf('Presto') > -1, //opera内核
          webKit: ua.indexOf('AppleWebKit') > -1, //苹果、谷歌内核
          gecko: ua.indexOf('Gecko') > -1 && ua.indexOf('KHTML') == -1, //火狐内核
        }
      }
      console.log('测试浏览器内核信息:',kernelInfo())
    </script>
  </body>
</html>
